package com.example.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.entity.Business;
import com.example.entity.KHMS;
import com.example.util.page;
import com.example.util.page4;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.SelectKey;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tyhxzy
 * @since 2023-11-03
 */
public interface BusinessMapper extends BaseMapper<Business> {
    //使命分页
    Page<Map> findByParams(Page p1, @Param("xx") page Business);

    List<Business> findByBName(Business business);

    Business findByid(Integer zid);

    //商户分页
    Page<Map> findpage(Page p1, @Param("xx") page4 Business);

    @Update("update business set name=#{legalRepresentative},companyname=#{customerName},address=#{depositaryBank},credit=#{permitNumber} where zid=#{zid}")
    @SelectKey(keyColumn = "id", keyProperty = "id", statement = "select last_insert_id()", before = false, resultType = Integer.class)
    int add(KHMS khms);

    @Insert("insert into business(zid,status) values (#{zid},18)")
    int addZid(Integer zid);

    @Update("update business set front=#{front} where zid=#{zid}")
    int update(Business business);

    @Update("update business set door=#{door} where zid=#{zid}")
    int update1(Business business);

//    @Insert("insert into business (name,companyname,credit,term,address,mainbusiness,door) values (#{legalRepresentative},#{customerName},#{permitNumber},#{term},#{address},#{mainbusiness},#{doorhead})")
//    @SelectKey(keyColumn = "id", keyProperty = "id", statement = "select last_insert_id()", before = false, resultType = Integer.class)
//    int add(KHMS khms);

}
